layout.tsx 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. import { Inter, Permanent_Marker } from "next/font/google";
  2. import { GeistSans } from "geist/font/sans";
  3. import { GeistMono } from "geist/font/mono";
  4. import { cn } from "@/shared/lib/utils";
  5. import { getServerUrl } from "@/shared/lib/server-url";
  6. import { SiteConfig } from "@/shared/config/site-config";
  7. import { WorkoutSessionsSynchronizer } from "@/features/workout-session/ui/workout-sessions-synchronizer";
  8. import { ThemeSynchronizer } from "@/features/theme/ui/ThemeSynchronizer";
  9. import { Header } from "@/features/layout/Header";
  10. import { Footer } from "@/features/layout/Footer";
  11. import { TailwindIndicator } from "@/components/utils/TailwindIndicator";
  12. import { NextTopLoader } from "@/components/ui/next-top-loader";
  13. import { ServiceWorkerRegistration } from "@/components/pwa/ServiceWorkerRegistration";
  14. import { Providers } from "./providers";
  15. import type { ReactElement } from "react";
  16. import type { Metadata } from "next";
  17. import "@/shared/styles/globals.css";
  18. export const metadata: Metadata = {
  19. title: {
  20. default: SiteConfig.title,
  21. template: `%s | ${SiteConfig.title}`,
  22. },
  23. description: SiteConfig.description,
  24. metadataBase: new URL(getServerUrl()),
  25. robots: {
  26. index: true,
  27. follow: true,
  28. googleBot: {
  29. index: true,
  30. follow: true,
  31. "max-snippet": -1,
  32. "max-image-preview": "large",
  33. "max-video-preview": -1,
  34. },
  35. },
  36. openGraph: {
  37. title: SiteConfig.title,
  38. description: SiteConfig.description,
  39. url: getServerUrl(),
  40. siteName: SiteConfig.title,
  41. images: [
  42. {
  43. url: `${getServerUrl()}/images/default-og-image_fr.png`,
  44. width: 1200,
  45. height: 630,
  46. alt: SiteConfig.title,
  47. },
  48. {
  49. url: `${getServerUrl()}/images/default-og-image_en.png`,
  50. width: 1200,
  51. height: 630,
  52. alt: SiteConfig.title,
  53. },
  54. ],
  55. locale: "fr_FR",
  56. type: "website",
  57. },
  58. twitter: {
  59. card: "summary_large_image",
  60. site: "@workout_cool",
  61. title: SiteConfig.title,
  62. description: SiteConfig.description,
  63. images: [`${getServerUrl()}/images/default-og-image_fr.png`],
  64. },
  65. alternates: {
  66. canonical: "https://www.workout.cool",
  67. languages: {
  68. fr: "https://www.workout.cool/fr",
  69. en: "https://www.workout.cool/en",
  70. },
  71. },
  72. authors: [{ name: "Workout Cool", url: "https://www.workout.cool" }],
  73. icons: {
  74. icon: [
  75. { url: "/images/favicon-32x32.png", sizes: "32x32", type: "image/png" },
  76. { url: "/images/favicon-16x16.png", sizes: "16x16", type: "image/png" },
  77. { url: "/images/favicon.ico", type: "image/x-icon" },
  78. ],
  79. apple: "/apple-touch-icon.png",
  80. },
  81. };
  82. const inter = Inter({
  83. subsets: ["latin"],
  84. variable: "--font-inter",
  85. display: "swap",
  86. });
  87. const permanentMarker = Permanent_Marker({
  88. weight: "400",
  89. subsets: ["latin"],
  90. variable: "--font-permanent-marker",
  91. display: "swap",
  92. });
  93. export const preferredRegion = ["fra1", "sfo1", "iad1"];
  94. interface RootLayoutProps {
  95. params: Promise<{ locale: string }>;
  96. children: ReactElement;
  97. }
  98. export default async function RootLayout({ params, children }: RootLayoutProps) {
  99. const { locale } = await params;
  100. return (
  101. <>
  102. <html className="h-full" dir="ltr" lang={locale} suppressHydrationWarning>
  103. <head>
  104. <meta charSet="UTF-8" />
  105. <meta content="width=device-width, initial-scale=1, maximum-scale=1 viewport-fit=cover" name="viewport" />
  106. {/* PWA Meta Tags */}
  107. <meta content="yes" name="apple-mobile-web-app-capable" />
  108. <meta content="default" name="apple-mobile-web-app-status-bar-style" />
  109. <meta content="Workout Cool" name="apple-mobile-web-app-title" />
  110. <meta content="yes" name="mobile-web-app-capable" />
  111. <meta content="#FF5722" name="msapplication-TileColor" />
  112. <meta content="/android-chrome-192x192.png" name="msapplication-TileImage" />
  113. {/* PWA Manifest */}
  114. <link href="/manifest.json" rel="manifest" />
  115. {/* eslint-disable-next-line @next/next/no-page-custom-font */}
  116. <link as="style" href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="preload" />
  117. {/* Alternate hreflang for i18n */}
  118. <link href="https://www.workout.cool/fr" hrefLang="fr" rel="alternate" />
  119. <link href="https://www.workout.cool/en" hrefLang="en" rel="alternate" />
  120. {/* Theme color for PWA */}
  121. <meta content="#FF5722" name="theme-color" />
  122. </head>
  123. <body
  124. className={cn(
  125. "flex items-center justify-center min-h-screen w-full p-8 max-sm:p-0 max-sm:min-h-full bg-base-200 dark:bg-[#18181b] dark:text-gray-200 antialiased",
  126. "bg-hero-light dark:bg-hero-dark",
  127. GeistMono.variable,
  128. GeistSans.variable,
  129. inter.variable,
  130. permanentMarker.variable,
  131. )}
  132. suppressHydrationWarning
  133. >
  134. <Providers locale={locale}>
  135. <ServiceWorkerRegistration />
  136. <WorkoutSessionsSynchronizer />
  137. <ThemeSynchronizer />
  138. <NextTopLoader color="#FF5722" delay={100} showSpinner={false} />
  139. {/* Main Card Container */}
  140. <div className="card w-full max-w-3xl min-h-[500px] max-h-[90vh] h-[80vh] bg-white dark:bg-[#232324] shadow-xl border border-base-200 dark:border-slate-700 flex flex-col justify-between overflow-hidden max-sm:rounded-none max-sm:h-full rounded-lg">
  141. <Header />
  142. <div className="flex-1 overflow-auto flex flex-col">{children}</div>
  143. <Footer />
  144. </div>
  145. <TailwindIndicator />
  146. </Providers>
  147. </body>
  148. </html>
  149. </>
  150. );
  151. }